import { getcollectidarrapi } from "@/apis/user";
import { edimtheme, thumbdobjtype, usertype } from "../reducers/home";
import {
  changethemetype,
  getthumbarr,
  loginaction,
  thunkAction,
} from "../types/home";
// import {login, logintype} from '@/apis/user'

export const loginpatch = (payload: usertype | {}): loginaction => ({
  type: "login",
  payload,
});
//获取当前用户收藏的文章id
export const getcollectidar1 = (payload: thumbdobjtype): getthumbarr => ({
  type: "getthumbarr",
  payload,
});
//改变文章详情的主题
export const changethemeinessay = (payload: edimtheme): changethemetype => ({
  type: "changethemeinessay",
  payload,
});
//获取当前用户收藏的文章id，点赞的留言，点赞的评论的id
export const getcollectidarraction = (id: number): thunkAction => {
  return async (dispatch) => {
    const result: any = await getcollectidarrapi(id);
    dispatch(getcollectidar1(result.result));
  };
};
